# Contributor: Sören Tempel <soeren+alpine@soeren-tempel.net>
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=pinentry-ui
pkgver=1.3.1
pkgrel=0
pkgdesc="Graphical UI's for Pinentry"
url="https://www.gnupg.org/aegypten2/"
arch="all"
license="GPL-2.0-or-later"
makedepends="
	gcr-dev
	gtk+2.0-dev
	libassuan-dev
	libcap-dev
	libgpg-error-dev
	libsecret-dev
	qt6-qtbase-dev
	"
subpackages="
	pinentry-gtk
	pinentry-gnome
	pinentry-qt
	"
source="https://gnupg.org/ftp/gcrypt/pinentry/pinentry-$pkgver.tar.bz2"
builddir="$srcdir/pinentry-$pkgver"

build() {
	./configure \
		--build=$CBUILD \
		--host=$CHOST \
		--prefix=/usr \
		--enable-fallback-curses \
		--enable-libsecret \
		--disable-pinentry-curses \
		--enable-pinentry-gnome3 \
		--enable-pinentry-gtk2 \
		--enable-pinentry-qt
	make
}

check() {
	make check
}

package() {
	make DESTDIR="$pkgdir" install

	# created by post install scripts so we can override with other UI versions
	rm -f "$pkgdir"/usr/bin/pinentry
}

gtk() {
	install="$subpkgname.post-install $subpkgname.post-deinstall"

	amove usr/bin/pinentry-gtk*
}

gnome() {
	depends="gcr"
	install="$subpkgname.post-install $subpkgname.post-deinstall"

	amove usr/bin/pinentry-gnome3
}

qt() {
	install="$subpkgname.post-install $subpkgname.post-deinstall"

	amove usr/bin/pinentry-qt*
}

sha512sums="
3b72034dc1792b1475acb6d605ff7c1bd7647a0f02d1b6bdcd475acdef24bc802f49e275055436c3271261c4b7a64168477a698aab812a145962146b2f67a0e2  pinentry-1.3.1.tar.bz2
"
